home *** CD-ROM | disk | FTP | other *** search
-
-
- (Version 2.0, December 5, 1985)
-
- INT13 DOCUMENTATION
-
-
- The file INT13V20.ARC contains the following:
-
- INT13.ASM - Source file for INT13.COM
- INT13.COM - Resident interrupt 13h handler
- INT13.DOC - This documentation file
-
-
- I. Function of INT13.COM
-
- INT13.COM is a resident "front-end" program which intercepts ROM
- BIOS interrupt 13h calls to perform disk functions on specific sectors.
- INT13.COM prints out the following information about each interrupt
- 13h call:
-
- Information sent to Interrupt 13h processing-
-
- 1. Requested disk drive (program currently reports only calls to
- drive A:)
- 2. Side number
- 3. Track number
- 4. Sector number
- 5. Number of sectors requested
- 6. Operation type (0=reset 1=read status 2=read 3=write 4=verify)
-
- Information received from interrupt 13h processing-
-
- 7. Return code (result of interrupt 13h call, 00 = no error)
- 8. Address immediately after point where call was made
- * 9. ST0 - see XT Technical Reference Manual pps. 1-164-166
- * 10. ST1 " " " " " " "
- * 11. ST2 " " " " " " "
- * 12. C (track found by controller)
- * 13. H (side found by controller)
- * 14. R (sector found by controller, not reliable)
- * 15. N (sector size, 0=128, 1=256, 2=512, 3=1024, etc.)
-
- * = new features of version 2.0
-
- II. Purpose of INT13.COM
-
- INT13.COM was written as a tool to help unravel copy protection
- schemes, virtually all of which use interrupt 13h to look for weirdly-
- formatted tracks on the original "key" diskette. This utility allows
- you to find out - without searching through a disassembly of the program
- - what the copy protection scheme is looking for on the key diskette.
- The return address printed shows where (or, more accurately, the point
- immediately after) the call to interrupt 13h was made. This can be
- especially useful where the copy protection scheme trys - as many do -
- to disguise the interrupt call so as to thwart casual attempts to defeat
- the protection.
-
- I will not attempt to provide detailed information on the various
- codes associated with interrupt 13h processing since this information is
- available in any book on IBM Assembly Language or in the IBM Technical
- Reference manuals. In general, however, a few things to look for in a
- protection scheme are:
-
- a. Sector numbers outside the normal range of 1 through 9.
-
- b. Sectors deliberately formatted with CRC errors. The pro-
- tection scheme either "reads" (operation code 02) or "veri-
- fies" (operation code 04) the sectors. The program then
- expects to get a return code of 10, indicating the sectors do
- indeed contain CRC errors. (CRC errors can occur in the data
- field and the id fields. The return code field does not
- distinguish between the two; the type of CRC error is shown
- by the values in ST1 and ST2).
-
- c. Multiple calls for the same sector. Some schemes format a
- track with two sectors with the same number.
-
- d. Missing sector numbers on an otherwise normal track.
-
- e. Sectors with "N" sizes other than the normal 2 (512 bytes).
-
-
- III. Using INT13.COM
-
- Before executing the program to be examined, simply run INT13. A
- short message will be displayed indicating that the program has been
- installed. Your printer will display the information described above,
- one line for each interrupt 13h call. When you are finished, execute
- INT13 one more time, and it will un-install itself, displaying a message
- to this effect.
-
- With the amount of information displayed for each int 13h call,
- appoximately 130 characters are printed on each line. The default setup
- is for INT13 to use the Epson "compressed" mode of printing to accomodate
- all the data on a single line. If your printer does not have a
- "compressed" mode, you may force 80-column printing by entering INT13 /8.
-
- If you are not using DEBUG, then simply execute your program. A log
- of the disk activity will then be printed. Program loading and execu-
- tion will be slowed due to the time required for printing.
-
- If you are using DEBUG, then proceed as you would normally. The
- addresses reported on the disk activity log will correspond to the
- locations in the program being debugged so you may immediately see where
- the calls are being made.
-
- It is advisable to run INT13 with your program more than one time
- since some protection schemes select different tracks for checking on a
- random basis.
-
- Note: Since copy protection schemes rarely, if ever, check other
- than the "A" diskette drive, INT13 is set up to log only calls to that
- drive. If you wish disk activity on all drives to be logged, remove the
- instructions listed in the source code and reassemble the program.
-
-
- IV. Interpreting the results
-
- This is the hardest part. If you are going to become an accom-
- plished "unprotector" you will have to have at least a passing knowledge
- of assembly language. INT13 will point you to the part(s) of the pro-
- gram doing the protection verification and will show you what the pro-
- gram expects to find. It's up to you to figure out how to bypass the
- protection. This can be quite easy, sometimes only requiring a branch
- around the code doing the protection verification, or it can involve
- hours of single-stepping through the program for really devious
- protection schemes. Either way, INT13 should speed up things.
-
-
- V. Caveats
-
- Since INT13 functions under DOS's control, this utility will not
- always function with some game programs which have their own operating
- system on the disk.
-
- INT13 also doesn't work with Prolok- and Softguard-protected
- diskettes because these systems access the diskette adapter directly and
- do not use interrupt 13h.
-
-
- VI. How INT13 works
-
- When you run INT13, the vector in low memory which normally points
- to the ROM BIOS routine for interrupt 13h is changed to point to the
- front-end processing contained in INT13. When your program issues an
- interrupt 13h call, control goes first to INT13 and the required
- information is stored for later printout. Control is then passed to the
- normal interrupt 13h routine. When the I/O processing is finished,
- INT13 regains control and prints the log data, including the return code
- passed back. Finally, control returns to the calling program. If you
- are interested in further details, examine the source code.
-
-
- VII. How some protection schemes attempt to disguise interrupt 13h
- calls
-
- If you are attempting to unprotect a program, the usual course of
- action is to search for occurences of "CD13", which is machine language
- for interrupt 13h. One way or another, the protection scheme will have
- to use this interrupt to check for the special sectors on the disk. If
- you examine a cross section of programs, however, you will find programs
- which do not have "CD13" in their machine code, but which clearly are
- checking the key diskette for weird sectors. How is this being done?
-
- There are several techniques which can be used to camouflage the
- protection scheme from prying eyes. I'll describe below two such
- techniques I have come across:
-
- a. The following section of code is equivalent to issuing a INT 13
- command to read one sector from: drive A, side 0, track 28h,
- sector ffh, and then checking for a status code of 10h:
-
- XXXX:1000 MOV AH,02 ;read operation
- XXXX:1002 MOV AL,01 ;1 sector to read
- XXXX:1004 MOV CH,28 ;track 28h (40d)
- XXXX:1006 MOV CL,FF ;sector ffh (255d)
- XXXX:1008 MOV DX,0000 ;side 0, drive A
- XXXX:100B XOR BX,BX ;move 0
- XXXX:100D MOV DS,BX ; to DS register
- XXXX:100F PUSHF ;push the flags onto stack
- XXXX:1010 PUSH CS ;push the CS register
- XXXX:1011 CALL 1100 ;push addr. of next instr.
- ; onto stack and branch
- XXXX:1014 CMP AH,10 ;check for CRC error
- XXXX:1017 rest of verification code
- .
- .
- .
- XXXX:1100 PUSHF ;push the flags onto stack
- XXXX:1101 MOV BX,004C ;addr. of int 13h vector
- XXXX:1104 PUSH [BX+02] ;push CS of int13h routine
- XXXX:1107 PUSH [BX] ;push IP of int13h routine
- XXXX:1109 IRET ;pop IP,CS and flags
-
- Notice that there is no "INT 13" command in the source code, so
- if you had simply used DEBUG to search for "CD13" in the machine
- code, you would never have found the protection routine.
-
-
- b. Another technique is to put in a substitute interrupt instruc-
- tion (such as INT 10, which looks harmless enough), and have the
- program change the "10" to "13". A search for "CD13" would turn
- up nothing.
-